﻿using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.OleDb;
using System.Data.SqlClient;
using System.Configuration;

namespace DAO
{   
    public class DataProvider
    {
        //Khai bao duong dan den Database       
        protected static SqlConnection MoKetNoi = null;
        //protected static string LenhKetNoi = "Server=.\\sqlexpress; Database=quanlynhahang; Trusted_Connection=true";
        protected static string LenhKetNoi = DAO.Properties.Settings.Default.ConnectionString;
        public static SqlConnection KetNoi()
        {
            MoKetNoi = new SqlConnection(LenhKetNoi);
            MoKetNoi.Open();
            return MoKetNoi;
        }
        public static void DongKetNoi()
        {
            if (MoKetNoi.State == System.Data.ConnectionState.Open)
            {
                MoKetNoi.Close();
            }
        }
    }
}
